﻿// (c) Andreas Kreisl 
// You are not permitted to use this in any way!


function class_TextLine4(myFrame,vOffset,label,tcount) {
	this.size    = mod_sysmonitor_size;
	this.vOffset = vOffset;
	this.color   = "#FFFFFF";
	this.text    = "";

	this.label = new Text();
	myFrame.appendChild(this.label);
	this.label.data = label;
	this.label.size = this.size;
	this.label.font = "Tahamo";
	this.label.style.fontWeight = "bold";
	this.label.color = this.color;
	this.label.style.textAlign = "left"
	this.label.hOffset = 0;
	this.label.vOffset = this.vOffset + this.size;
	this.label.width = (mod_sysmonitor_width/(tcount+1));

	this.t = new Array();
	for(var i = 0; i < tcount; i++) {
		this.t[i] = new Text();
		myFrame.appendChild(this.t[i]);
		this.t[i].data = "";
		this.t[i].size = this.size;
		this.t[i].font = "Tahamo";
		this.t[i].color = this.color;

		this.t[i].style.fontWeight = "bold";
		this.t[i].style.textAlign = "right"

		this.t[i].vOffset = this.vOffset + this.size;
		this.t[i].hOffset = (mod_sysmonitor_width/(tcount+1))*(i+1);
		this.t[i].width = (mod_sysmonitor_width/(tcount+1));
	}

	// --- --- --- WATCH Member-Variables --- --- ---

	this.watch("size", function (p_name,p_old,p_new) {
		this.label.size = p_new;
		this.label.vOffset = this.vOffset + p_new;

		for(var i = 0; i < this.t.length; i++) {
			this.t[i].size = p_new;
			this.t[i].vOffset = this.vOffset + p_new;
			this.t[i].hOffset = (mod_sysmonitor_width/(tcount+1))*(tcount+1);
			this.t[i].width = (mod_sysmonitor_width/(tcount+1));
		}
		return p_new;
	});

	this.watch("vOffset", function (p_name,p_old,p_new) {
		this.label.vOffset = p_new + this.size;
		for(var i = 0; i < this.t.length; i++)
			this.t[i].vOffset = p_new + this.size;
		return p_new;
	});

	this.watch("color", function (p_name,p_old,p_new) {
		this.label.color = p_new;
		for(var i = 0; i < this.t.length; i++)
			this.t[i].color = p_new;
		return p_new;
	});

	this.watch("text", function (p_name,p_old,p_new) {
		var tmp = p_new.split("\n");
		for(var i = 0; i < this.t.length; i++)
			this.t[i].data = tmp[i];
		return p_new;
	});

	return true;
}


